package com.beiye.drivertransport.activity;

import android.app.Activity;
import android.content.Intent;
import android.graphics.Color;
import android.os.Bundle;
import android.os.Handler;
import android.view.KeyEvent;

import com.beiye.drivertransport.R;
import com.githang.statusbar.StatusBarCompat;

//欢迎界面
public class SplashActivity extends Activity {
    private final int SPLASH_DISPLAY_LENGHT = 1500;
    private Handler handler;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_splash);
        initData();

    }
    public void initData() {
        StatusBarCompat.setStatusBarColor(this,Color.parseColor("#FFFFFF"));
   //    getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);


        handler = new Handler();
        // 延迟SPLASH_DISPLAY_LENGHT时间然后跳转到MainActivity
        handler.postDelayed(new Runnable() {

            @Override
            public void run() {
                Intent intent = new Intent(SplashActivity.this,
                        MainLearnActivity.class);
                startActivity(intent);
//              startActivity(MainActivity.class,null);
              finish();
                overridePendingTransition(android.R.anim.fade_in, android.R.anim.fade_out);
            }
        }, SPLASH_DISPLAY_LENGHT);
    }



    @Override
    public boolean onKeyDown(int keyCode, KeyEvent event) {
        if(keyCode == KeyEvent.KEYCODE_BACK){
            return  true;
            }
        return  super.onKeyDown(keyCode, event);
         }
}
